import React, { useState } from 'react'
const App = function () {
    //[{age:16},{age:19}]
    const [list, setList] = useState([{ age: 16 }, { age: 19 }])
    const setStatc = (index) => {
        const _list = [...list]
        _list[index].age = _list[index].age + 1
        setList(_list)
    }
    return <div>
        {
            list.map((item, index) => {
                return <h2 key={index} onClick={() => setStatc(index)}>
                    {item.age}
                </h2>
            })
        }
    </div>


}
export default App


